[?php if ($field->isPartial()): ?]
  [?php include_partial('<?php echo $this->getModuleName() ?>/'.$name, array('type' => 'filter', 'form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?]
[?php elseif ($field->isComponent()): ?]
  [?php include_component('<?php echo $this->getModuleName() ?>', $name, array('type' => 'filter', 'form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?]
[?php else: ?]

    [?php if($count == 0): ?]
  <tr class="[?php echo $class ?]" colspan="[?php echo $widget_per_row*2 ?]">
          [?php endif; ?]
    <td>
      [?php echo $form[$name]->renderLabel($label) ?]
    </td>
    <td>
      [?php echo $form[$name]->renderError() ?]

      [?php echo $form[$name]->render($attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes) ?]

      [?php if ($help || $help = $form[$name]->renderHelp()): ?]
        <div class="help">[?php echo __($help, array(), '<?php echo $this->getI18nCatalogue() ?>') ?]</div>
      [?php endif; ?]
    </td>
    
    [?php if($count == $last_field): ?]
        [?php if(($count % $widget_per_row)== 0): ?]
            </tr>
        [?php endif; ?]
        [?php if(($count % $widget_per_row)== 1): ?]
            <td></td><td></td><td></td><td></td><td></td><td></td></tr>
        [?php endif; ?]
        [?php if(($count % $widget_per_row)== 2): ?]
            <td></td><td></td><td></td><td></td></tr>
        [?php endif; ?]
        [?php if(($count % $widget_per_row)== 3): ?]
            <td></td><td></td></tr>
        [?php endif; ?]
    [?php else: ?]
        [?php if(($count % $widget_per_row)==0): ?]
            </tr>
          [?php endif; ?]
    [?php endif; ?]
[?php endif; ?]
